package com.mxr.boot;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.core.annotation.Order;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.util.Log4jConfigListener;

@SuppressWarnings("deprecation")
@Order(1)
public class WebInitializer implements WebApplicationInitializer {

	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		//=========配置log4j=========
		servletContext.setInitParameter("log4jConfigLocation", "classpath:log4j.properties");
		servletContext.setInitParameter("webAppRootKey", "webapp.root");
		//3000表示 开一条watchdog线程每60秒扫描一下配置文件的变化;这样便于日志存放位置的改变
		servletContext.setInitParameter("log4jRefreshInterval", "3000");
		servletContext.addListener(new Log4jConfigListener());
		
	}

}
